/**
 * 管理相关方法
 */
import request from '@/utils/request'

export function getArticles (params) {
  return request({
    url: '/mp/v1_0/articles',
    params
  })
}

// 获取文章频道
export function getChannel () {
  return request({
    url: '/mp/v1_0/channels'
  })
}
// 删除文章
export function delArticle (id) {
  return request({
    url: `/mp/v1_0/articles/${id}`,
    method: 'DELETE'
  })
}

// 获取用户的图片素材
export function getImages (params) {
  return request({
    url: '/mp/v1_0/user/images',
    params
  })
}

// 收藏/取消图片
export function collectImg (id, collect) {
  return request({
    url: `/mp/v1_0/user/images/${id}`,
    method: 'put',
    data: {
      collect
    }
  })
}

// 删除图片
export const deleteImage = id => request({
  method: 'DELETE',
  url: '/mp/v1_0/user/images/' + id
})
